package com.xps.and.yuntong.Data.bean1;

import com.google.gson.Gson;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by Administrator on 2018/1/12.
 */

public class LoginBean {

    @Override
    public String toString() {
        return "LoginBean{" +
                "return_code='" + return_code + '\'' +
                ", return_msg='" + return_msg + '\'' +
                ", return_body=" + return_body +
                '}';
    }

    /**
     * return_code : SUCCESS
     * return_msg : 登录成功
     * return_body : {"user_id":957,"name":"郑英","mobile_phone":"17146779776","head_img":"http://yuntontech.oss-cn-beijing.aliyuncs.com/default/headImg/man.png","balance":"0.00","driver_id":356,"sex":1,"access_token":"5TbRXCNStK2Vyb8dL6KCJRlLsVMIhZun","idcard_id":"130XXXXXXXXXXXXXX","car_id":"津R14231","avg_score":4}
     */

    private String return_code;
    private String return_msg;
    private ReturnBodyBean return_body;

    public static LoginBean objectFromData(String str) {

        return new Gson().fromJson(str, LoginBean.class);
    }

    public static LoginBean objectFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);

            return new Gson().fromJson(jsonObject.getString(str), LoginBean.class);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return null;
    }

    public String getReturn_code() {
        return return_code;
    }

    public void setReturn_code(String return_code) {
        this.return_code = return_code;
    }

    public String getReturn_msg() {
        return return_msg;
    }

    public void setReturn_msg(String return_msg) {
        this.return_msg = return_msg;
    }

    public ReturnBodyBean getReturn_body() {
        return return_body;
    }

    public void setReturn_body(ReturnBodyBean return_body) {
        this.return_body = return_body;
    }

    public static class ReturnBodyBean {
        @Override
        public String toString() {
            return "ReturnBodyBean{" +
                    "user_id=" + user_id +
                    ", name='" + name + '\'' +
                    ", mobile_phone='" + mobile_phone + '\'' +
                    ", head_img='" + head_img + '\'' +
                    ", balance='" + balance + '\'' +
                    ", driver_id=" + driver_id +
                    ", sex=" + sex +
                    ", access_token='" + access_token + '\'' +
                    ", idcard_id='" + idcard_id + '\'' +
                    ", car_id='" + car_id + '\'' +
                    ", avg_score=" + avg_score +
                    '}';
        }

        /**
         * user_id : 957
         * name : 郑英
         * mobile_phone : 17146779776
         * head_img : http://yuntontech.oss-cn-beijing.aliyuncs.com/default/headImg/man.png
         * balance : 0.00
         * driver_id : 356
         * sex : 1
         * access_token : 5TbRXCNStK2Vyb8dL6KCJRlLsVMIhZun
         * idcard_id : 130XXXXXXXXXXXXXX
         * car_id : 津R14231
         * avg_score : 4
         */

        private int user_id;
        private String name;
        private String mobile_phone;
        private String head_img;
        private String balance;
        private int driver_id;
        private int sex;
        private String access_token;
        private String idcard_id;
        private String car_id;
        private int avg_score;

        public static ReturnBodyBean objectFromData(String str) {

            return new Gson().fromJson(str, ReturnBodyBean.class);
        }

        public static ReturnBodyBean objectFromData(String str, String key) {

            try {
                JSONObject jsonObject = new JSONObject(str);

                return new Gson().fromJson(jsonObject.getString(str), ReturnBodyBean.class);
            } catch (JSONException e) {
                e.printStackTrace();
            }

            return null;
        }

        public int getUser_id() {
            return user_id;
        }

        public void setUser_id(int user_id) {
            this.user_id = user_id;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getMobile_phone() {
            return mobile_phone;
        }

        public void setMobile_phone(String mobile_phone) {
            this.mobile_phone = mobile_phone;
        }

        public String getHead_img() {
            return head_img;
        }

        public void setHead_img(String head_img) {
            this.head_img = head_img;
        }

        public String getBalance() {
            return balance;
        }

        public void setBalance(String balance) {
            this.balance = balance;
        }

        public int getDriver_id() {
            return driver_id;
        }

        public void setDriver_id(int driver_id) {
            this.driver_id = driver_id;
        }

        public int getSex() {
            return sex;
        }

        public void setSex(int sex) {
            this.sex = sex;
        }

        public String getAccess_token() {
            return access_token;
        }

        public void setAccess_token(String access_token) {
            this.access_token = access_token;
        }

        public String getIdcard_id() {
            return idcard_id;
        }

        public void setIdcard_id(String idcard_id) {
            this.idcard_id = idcard_id;
        }

        public String getCar_id() {
            return car_id;
        }

        public void setCar_id(String car_id) {
            this.car_id = car_id;
        }

        public int getAvg_score() {
            return avg_score;
        }

        public void setAvg_score(int avg_score) {
            this.avg_score = avg_score;
        }
    }
}
